package com.example.ddanjifeedmaker;


import FeedMaker.DropBoxHandler;
import android.os.Bundle;
import android.app.Activity;
import android.content.ComponentName;
import android.content.Intent;
import android.view.Menu;

public class MainActivity extends Activity {

	ComponentName feed_maker_service_;
	
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        
        DropBoxHandler.inst().init(MainActivity.this);
        feed_maker_service_ = startService( new Intent(MainActivity.this, DdanjiFeedMaker.class) );
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        getMenuInflater().inflate(R.menu.activity_main, menu);
        return true;
    }
    
    @Override
	public void onDestroy()
	{
    	if( feed_maker_service_ != null )
    	{
    		Intent i = new Intent();
    		i.setComponent(feed_maker_service_);
    		stopService(i);
    	}
    	
		super.onDestroy();
	}
    
    @Override
    protected void onResume() {
        super.onResume();
        DropBoxHandler.inst().resume(MainActivity.this);
    }
}
